package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.index.LindiIndexQueryVO;
import com.minimalist.common.entity.lindi.vo.index.LindiIndexVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiIndexFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import java.util.Map;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 林地指标 Feign 客户端
 *
 * @author 11987
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiIndexFeignClient"
        , path = "/minimalist/lindi/index"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiIndexFeignClientFallbackFactory.class)
public interface LindiIndexFeignClient{
    /**
     * 添加指标
     *
     * @param indexVO 指标信息
     * @return 成功或失败
     */
    @PostMapping("/addIndex")
    @Operation(summary = "添加指标")
    R<?> addIndex(@RequestBody @Validated(Add.class) LindiIndexVO indexVO);

    /**
     * 删除指标 -> 根据指标ID删除
     *
     * @param indexId 指标ID
     * @return 成功或失败
     */
    @DeleteMapping("/deleteIndexByIndexId")
    @Operation(summary = "删除指标 -> 根据指标ID删除")
    R<?> deleteIndexByIndexId(
            @RequestParam("indexId")
            @NotNull(message = "指标ID不能为空")
            @Parameter(name = "indexId", required = true, description = "指标ID")
            Long indexId);

    /**
     * 修改指标
     *
     * @param indexVO 指标信息
     * @return 成功或失败
     */
    @PutMapping("/updateIndexByIndexId")
    @Operation(summary = "修改指标")
    R<?> updateIndexByIndexId(@RequestBody @Validated(Update.class) LindiIndexVO indexVO);

    /**
     * 查询指标列表(分页)
     *
     * @param queryVO 查询条件
     * @return 成功或失败
     */
    @GetMapping("/getPageIndexList")
    @Operation(summary = "查询指标列表(分页)")
    R<PageResp<LindiIndexVO>> getPageIndexList(LindiIndexQueryVO queryVO);

    /**
     * 根据指标ID查询指标
     *
     * @param indexId 指标ID
     * @return 成功或失败
     */
    @GetMapping("/getIndexByIndexId/{indexId}")
    @Operation(summary = "根据指标ID查询指标")
    R<LindiIndexVO> getIndexByIndexId(
            @PathVariable(value = "indexId")
            @NotNull(message = "指标ID不能为空")
            @Parameter(name = "indexId", description = "指标ID", required = true)
            Long indexId);
            
    /**
     * 市储备库指标统计数据
     *
     * @return 统计数据
     */
    @GetMapping("/getStatistics")
    @Operation(summary = "市储备库指标统计数据")
    R<Map<String, Object>> getStatistics();

    /**
     * 获取可交易的镇街名称列表
     *
     * @return 可交易镇街名称列表
     */
    @GetMapping("/getEnableTradeTownNameList")
    @Operation(summary = "获取可交易的镇街名称列表")
    R<java.util.List<String>> getEnableTradeTownNameList();
}
